﻿#ifndef TEXTEDIT_H
#define TEXTEDIT_H
#include <QTextEdit>

class TextEdit : public QTextEdit
{
    Q_OBJECT
public:
    TextEdit(QWidget*parent=nullptr);
    bool initNewDoc();
    QString getDocName();
    bool loadDoc(const QString &filename);
    void initOpenDoc(const QString &filename);

    bool saveDoc();
    bool saveAsDoc();

    QString getWindoTitle()const;

private slots:
    void setWindowModify();

private:
    bool writeToDoc(const QString&filename);

protected:
    void closeEvent(QCloseEvent*event)override;

private:
    static int docNo;
    QString docwindowTitle;
    QString docName;
};

#endif // TEXTEDIT_H
